﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace SCS.Core.Models
{
    public class UserModel
    {
        public static SCSService.Security_User LoginUser(string userName, string password)
        {
            SCSService.UserService userSvc = new SCSService.UserService();
            return userSvc.LogInUser(userName, password);
        }

        public static SCSService.Security_Permission GetPermissionUser(int id)
        {
            SCSService.UserService userSvc = new SCSService.UserService();
            return userSvc.GetPermissionByUserID(id);
        }

        public static SCSService.Security_Role GetRoleUser(int id)
        { 
            SCSService.UserService userSvc = new SCSService.UserService();
            return userSvc.GetRoleUser(id);  
        }

        public static SCSService.Security_User GetUerByID(int id)
        {
            SCSService.UserService userSvc = new SCSService.UserService();
            return userSvc.GetUserByID(id);
        }

        public static void ChangePassword(SCSService.Security_User user)
        {
            SCSService.UserService userSvc = new SCSService.UserService();
            userSvc.ChangePassword(user);
        }

        public static int CreateUser(SCSService.Security_User user)
        {
            SCSService.UserService userSvc = new SCSService.UserService();
            return userSvc.CreateUser(user);
        }

        public static int CreateCustomer(SCSService.Customer customer)
        {
            SCSService.UserService userSvc = new SCSService.UserService();
            return userSvc.CreateCustomer(customer);
        }

        public static int CreateLog(SCSService.Security_User_Log log)
        {
            SCSService.UserService userSvc = new SCSService.UserService();
            return userSvc.CreateLog(log);
        }

        public static SCSService.Security_User UserForgotPassword(string userName, string email)
        {
            SCSService.UserService userSvc = new SCSService.UserService();
            return userSvc.GetUserByUserNameAndEmail(userName, email);
        }

        public static SCSService.Security_Role GetRoleByID(int id)
        {
            SCSService.UserService userSvc = new SCSService.UserService();
            return userSvc.GetRoleByID(id);
        }

        public static List<SCSService.Security_User> GetListUserByUserIDLogin(int? idLogin, int? priorityLogin, int? siteGuid, string UserName, string Email, byte? UserStatus)
        {
            SCSService.UserService userSvc = new SCSService.UserService();
            return userSvc.GetListUserByUserIDLogin(idLogin,priorityLogin,siteGuid,UserName,Email,UserStatus);
        }

        public static List<SCSService.Security_Role> GetListRoleByPriority(int priority, int? siteGuid)
        {
            SCSService.UserService userSvc = new SCSService.UserService();
            return userSvc.GetListRoleByPriority(priority,siteGuid);
        }

        public static void UpdateUser(SCSService.Security_User user)
        {
            SCSService.UserService userSvc = new SCSService.UserService();
            userSvc.UpdateUser(user);
        }

        public static void DeleteUser(int id)
        {
            SCSService.UserService userSvc = new SCSService.UserService();
            userSvc.DeleteUser(id);
        }

        public static void ChangeUserStatus(int? id, int? newStatus)
        {
            SCSService.UserService userSvc = new SCSService.UserService();
            userSvc.UpdateUserStatus(id, newStatus);
        }

        public static List<SCSService.Security_Permission> GetListSecurityPermissionByParentID(int? parentID)
        {
            SCSService.UserService userSvc = new SCSService.UserService();
            return userSvc.GetListSecurityPermissionByParentID(parentID);
        }

        public static SCSService.Security_Permission GetPermissionByID(int id)
        {
            SCSService.UserService userSvc = new SCSService.UserService();
            return userSvc.GetPermissionByID(id);
        }

        public static List<SCSService.Security_Role_Permission> GetListSecurityRolePermissionByRoleID(int id)
        {
            SCSService.UserService userSvc = new SCSService.UserService();
            return userSvc.GetListSecurityRolePermissionByRoleID(id);
        }

        public static void DeleteSecurityRolePermission(int perID,int roleID)
        {
            SCSService.UserService userSvc = new SCSService.UserService();
            userSvc.DeleteSecurityRolePermission(perID,roleID);
        }

        public static void CreateSecurityRolePermission(SCSService.Security_Role_Permission srp)
        {
            SCSService.UserService userSvc = new SCSService.UserService();
            userSvc.CreateSecurityRolePermission(srp);
        }

        public static List<SCSService.Security_Role> GetListRole(string RoleName, string RoleDes, byte? RoleStatus, int? Priority, int? siteGuid)
        {
            SCSService.UserService userSvc = new SCSService.UserService();
            return userSvc.GetListRole(RoleName,RoleDes,RoleStatus,Priority,siteGuid);
        }

        public static int CreateRole(SCSService.Security_Role role)
        {
            SCSService.UserService userSvc = new SCSService.UserService();
            return userSvc.CreateRole(role);
        }

        public static void UpdateRole(SCSService.Security_Role role)
        {
            SCSService.UserService userSvc = new SCSService.UserService();
            userSvc.UpdateRole(role);
        }

        public static void UpdateRoleStatus(int? id, int? newStatus)
        {
            SCSService.UserService userSvc = new SCSService.UserService();
            userSvc.UpdateRoleStatus(id, newStatus);
        }

        public static void DeleteSecurityRole(int id)
        {
            SCSService.UserService userSvc = new SCSService.UserService();
            userSvc.DeleteSecurityRole(id);
        }

        public static List<SCSService.Security_Permission> GetListPermission(string PerName, string PerDes, int? ParentID, byte? PerStatus,int? siteGuid)
        {
            SCSService.UserService userSvc = new SCSService.UserService();
            return userSvc.GetListPermission(PerName,PerDes,ParentID,PerStatus,siteGuid);
        }

        public static int CreateSecurityPermission(SCSService.Security_Permission per)
        {
            SCSService.UserService userSvc = new SCSService.UserService();
            return userSvc.CreateSecurityPermission(per);
        }

        public static void UpdateSecurityPermission(SCSService.Security_Permission per)
        {
            SCSService.UserService userSvc = new SCSService.UserService();
            userSvc.UpdateSecurityPermission(per);
        }

        public static void UpdatePermissionStatus(int? id, int? newStatus)
        {
            SCSService.UserService userSvc = new SCSService.UserService();
            userSvc.UpdatePermissionStatus(id,newStatus);
        }

        public static void DeleteSecurityPermission(int id)
        {
            SCSService.UserService userSvc = new SCSService.UserService();
            userSvc.DeleteSecurityPermission(id);
        }

        public static void CreateWebsiteUser(SCSService.Security_Website_User webUser)
        {
            SCSService.UserService userSvc = new SCSService.UserService();
            userSvc.CreateWebsiteUser(webUser);
        }

        public static void CreateWebsiteRole(SCSService.Sercurity_Website_Role webRole)
        {
            SCSService.UserService userSvc = new SCSService.UserService();
            userSvc.CreateWebsiteRole(webRole);
        }

        public static void CreateWebsitePermission(SCSService.Security_Website_Permission webPer)
        {
            SCSService.UserService userSvc = new SCSService.UserService();
            userSvc.CreateWebsitePermission(webPer);
        }

        public static List<SCSService.Security_Module_Permission> GetListModulePermissionByPerID(int PerId)
        {
            SCSService.UserService userSvc = new SCSService.UserService();
            return userSvc.GetListModulePermissionByPerID(PerId);
        }

        public static void DeleteModulePermission(int moduleID, int perID)
        {
            SCSService.UserService userSvc = new SCSService.UserService();
            userSvc.DeleteModulePermission(moduleID,perID);
        }

        public static void CreateModulePermission(SCSService.Security_Module_Permission smp)
        {
            SCSService.UserService userSvc = new SCSService.UserService();
            userSvc.CreateModulePermission(smp);
        }

        public static List<SCSService.Security_Page_Permission> GetListPagePermissionByPerID(int PerId)
        {
            SCSService.UserService userSvc = new SCSService.UserService();
            return userSvc.GetListPagePermissionByPerID(PerId);
        }

        public static void DeletePagePermission(int pageID, int perID)
        {
            SCSService.UserService userSvc = new SCSService.UserService();
            userSvc.DeletePagePermission(pageID,perID);
        }

        public static void CreatePagePermission(SCSService.Security_Page_Permission spp)
        {
            SCSService.UserService userSvc = new SCSService.UserService();
            userSvc.CreatePagePermission(spp);
        }

        public static SCSService.Security_Role GetRoleSystemByUser(int id)
        {
            SCSService.UserService userSvc = new SCSService.UserService();
            return userSvc.GetRoleSystemByUser(id);
        }

        public static SCSService.Security_Role GetRoleLocalSiteByUser(int id, int siteGuid)
        {
            SCSService.UserService userSvc = new SCSService.UserService();
            return userSvc.GetRoleLocalSiteByUser(id, siteGuid);
        }
    }
}